<?php
   class Contact extends MY_Controller{
	   public function __construct(){
		   parent::__construct();
		   $this->load->helper("url");
		   $this->load->model("model_home");
		   //$this->load->model("mindex");
		   $this->load->library("email");
           $this->load->model('contact_model');
	   }
	   public function index(){
		   $data['config'] 		= $this->config();
		   $data['contact'] 	= $this->model_home->contact();
		   //$this->debug($data['contact']);
		   $data['introduc']    = $this->model_index->intro();
		   $data['introduc']    = $this->model_index->intro();
		   $data['title'] = "Contact us";
		   $this->load->view("contact/layout",$data);
	   }
	   public function ajax(){
		   if(!$_POST){ die();}
		   $name  = $this->fillter($this->input->post("name"));
		   $email = $this->fillter($this->input->post("email"));
		   $country = $this->fillter($this->input->post("country"));
		   $phone = $this->fillter($this->input->post("phone"));
		   $subje  =  $this->fillter($this->input->post("subject"));
           $find  =  $this->fillter($this->input->post("find"));
           $mesage  =  $this->fillter($this->input->post("info"));
           $data = array(
               "con_name" => $name,
               "con_email" => $email,
			   "con_phone" => $phone,
               "con_country" => $country,
               "con_subject" => $subje,
               "con_find" => $find,
               "con_masage" => $mesage,
           );
           $this->contact_model->save($data);
           echo '<span style="color:green">Your submission is successful! Our cruise experts will reply to your inquiry within next 24 hours. Thank you !</span>';
       }
   }